﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;

namespace HW2
{
    class Program
    {
        static void Main(string[] args)
        {
                Random rdm = new Random();
                int[] arr = new int[100];
                for (int i = 0; i < arr.Length; i++)
                {
                    arr[i] = rdm.Next(0, 1001);
                System.Threading.Thread.Sleep(2);
                }
                Calc(arr);
        }
        public static void Calc(int[] arr)
        {
            double sum = 0;
            var query = from a in arr
                        where a >= 0
                        orderby a ascending
                        select a;
            foreach(var a in arr)
            {
                Console.Write(a + " ");
                sum += a;
            }
            double aver = sum / 100;
            Console.WriteLine();
            Console.WriteLine("该数组之和为：" + sum);
            Console.WriteLine("该数组平均数为：" + aver);
        }
    }
}
